home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programmer Power Tools
/
Programmer Power Tools.iso
/
c
/
jazlib.arc
/
JZDLTSTR.C
< prev
next >
Wrap
Text File
|
1986-06-05
|
2KB
|
40 lines
/*
┌────────────────────────────────────────────────────────────────────────────┐
│jzdltstr │
│Delete fnum chars from string fdestin starting at fstart. │
│Returns number of characters deleted. │
│Synopsis: │
│ *s = "this is a test"; │
│ jzdltstr(s,5,3); │
│ { results in "this a test" } │
│ │
│ (C) JazSoft Software by Jack A. Zucker (301) 794-5950 │
└────────────────────────────────────────────────────────────────────────────┘
*/
#include <jaz.h>
jzdltstr(fdestin,fstart,fnum)
char *fdestin;
int fstart;
int fnum;
{
int wdlen; /* hold length of destination string */
char *p; /* temporary pointer to fstart+fnum */
int w; /* string counter */
/* fstart is greater than string length */
if (((wdlen = strlen(fdestin)) < fstart))
return(0);
fnum = min(fnum,wdlen-fstart); /* don't delete past end of string */
p = fdestin + fstart + fnum; /* point to part of string to move */
fdestin += fstart; /* point to part of string to delete*/
for (w = 0 ; *fdestin++ = *p++ ; w ++)
;
return(w);
}